﻿/*
* Copyright (c) 2010-2012 Tesla Engine Group
* 
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
* 
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
* 
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/


using System;

namespace Tesla.Graphics {

    /// <summary>
    /// Sprite sort mode enumeration.
    /// </summary>
    public enum SpriteSortMode {
        /// <summary>
        /// Default, where sprites are queued and rendered all together in the order that they are received. No sorting
        /// is done.
        /// </summary>
        Deferred,
        /// <summary>
        /// Same as deferred, except sort back to front using the sprite's depth order. Useful for transparent sprites.
        /// </summary>
        BackToFront,
        /// <summary>
        /// Same as deferred, except sort front to back using the sprite's depth order. Useful for opaque sprites.
        /// </summary>
        FrontToBack,
        /// <summary>
        /// Same as deferred, except sort by texture, where all sprites that use the same texture will be drawn as a single batch.
        /// </summary>
        Texture,
        /// <summary>
        /// No sorting, draw the sprite immediately.
        /// </summary>
        Immediate
    }

    /// <summary>
    /// Bit flag enumeration for how sprites should be flipped when drawn, if at all.
    /// </summary>
    [Flags]
    public enum SpriteFlipEffect {
        /// <summary>
        /// Do not flip.
        /// </summary>
        None = 0,

        /// <summary>
        /// Flip horizontally (flip 180 degrees about Y-Axis).
        /// </summary>
        FlipHorizontally = 1,

        /// <summary>
        /// Flip vertically (flip 180 degrees about X-Axis).
        /// </summary>
        FlipVertically = 2
    }

    /// <summary>
    /// Stencil buffer operation enumeration.
    /// </summary>
    public enum StencilOperation {
        /// <summary>
        /// Do not update the stencil-buffer entry. This is the default value.
        /// </summary>
        Keep,

        /// <summary>
        /// Sets the stencil-buffer entry to zero.
        /// </summary>
        Zero,

        /// <summary>
        /// Replaces the stencil-buffer entry with the reference value.
        /// </summary>
        Replace,

        /// <summary>
        /// Increments the stencil-buffer entry, wrapping to zero if the new value
        /// exceeds the maximum value.
        /// </summary>
        Increment,

        /// <summary>
        /// Decrements the stencil-buffer entry, wrapping to the maximum value if the new
        /// value is less than zero.
        /// </summary>
        Decrement,

        /// <summary>
        /// Increments the stencil-buffer entry, clamping to the maximum value.
        /// </summary>
        IncrementAndClamp,

        /// <summary>
        /// Decrements the stencil-buffer entry, clamping to zero.
        /// </summary>
        DecrementAndClamp,

        /// <summary>
        /// Inverts the bits in the stencil-buffer entry.
        /// </summary>
        Invert
    }

    /// <summary>
    /// Comparison function enumeration for alpha, stencil, or depth-buffer testing.
    /// </summary>
    public enum ComparisonFunction {
        /// <summary>
        /// Always pass the test.
        /// </summary>
        Always,

        /// <summary>
        /// Always fail the test.
        /// </summary>
        Never,

        /// <summary>
        /// Accept new pixel if its value is less than the value of the current pixel.
        /// </summary>
        Less,

        /// <summary>
        /// Accept new pixel if its value is less than or equal to the value of the current pixel.
        /// </summary>
        LessEqual,

        /// <summary>
        /// Accept the new pixel if its value is equal to the value of the current pixel.
        /// </summary>
        Equal,

        /// <summary>
        /// Accept the new pixel if its value is greater than or equal to the value of the current pixel.
        /// </summary>
        GreaterEqual,

        /// <summary>
        /// Accept the new pixel if its value is greater than the value of the current pixel.
        /// </summary>
        Greater,

        /// <summary>
        /// Accept the new pixel if its value is not equal to the current pixel.
        /// </summary>
        NotEqual
    }

    /// <summary>
    /// Defines the channels that can be written to
    /// a render target's color buffer.
    /// </summary>
    [Flags]
    public enum ColorWriteChannels {
        /// <summary>
        /// Write to no channels.
        /// </summary>
        None = 0,

        /// <summary>
        /// Only write to the red (r) channel.
        /// </summary>
        Red = 1,

        /// <summary>
        /// Only write to the green (g) channel.
        /// </summary>
        Green = 2,

        /// <summary>
        /// Only write to the blue (b) channel.
        /// </summary>
        Blue = 4,

        /// <summary>
        /// Only write to the alpha (a) channel.
        /// </summary>
        Alpha = 8,

        /// <summary>
        /// Write to all (rgba) channels.
        /// </summary>
        All = 15
    }

    /// <summary>
    /// Defines the render state type.
    /// </summary>
    public enum RenderStateType {
        /// <summary>
        /// State is a BlendState.
        /// </summary>
        BlendState = 0,

        /// <summary>
        /// State is a DepthStencilState.
        /// </summary>
        DepthStencilState = 1,

        /// <summary>
        /// State is a RasterizerState.
        /// </summary>
        RasterizerState = 2,

        /// <summary>
        /// State is a SamplerState.
        /// </summary>
        SamplerState = 3
    }

    /// <summary>
    /// Defines how to combine source and destination colors for
    /// blending operations.
    /// </summary>
    public enum BlendFunction {
        /// <summary>
        /// Destination is added to the source. Result = (SourceColor * SourceBlend)
        /// + (DestinationColor * DestinationBlend).
        /// </summary>
        Add,

        /// <summary>
        /// Destination is subtracted from the source. Result = (SourceColor * SourceBlend)
        /// - (DestinationColor * DestinationBlend).
        /// </summary>
        Subtract,

        /// <summary>
        /// The source is subtracted from the destination. Result = (DestinationColor * DestinationBlend)
        /// - (SourceColor * SourceBlend).
        /// </summary>
        ReverseSubtract,

        /// <summary>
        /// The result is the minimum of source and destination. Result = min(SourceColor * SourceBlend),
        /// (DestinationColor * DestinationBlend)).
        /// </summary>
        Min,

        /// <summary>
        /// The result is the maximum of source and destination. Result = max(SourceColor * SourceBlend),
        /// (DestinationColor * DestinationBlend)).
        /// </summary>
        Max
    }

    /// <summary>
    /// Defines blending factors for source and destination colors.
    /// </summary>
    public enum Blend {
        /// <summary>
        /// Each color component is multiplied by (0, 0, 0, 0).
        /// </summary>
        Zero,

        /// <summary>
        /// Each color component is multiplied by (1, 1, 1, 1).
        /// </summary>
        One,

        /// <summary>
        /// Each color component is multiplied by the source color: (Rs, Gs, Bs, As).
        /// </summary>
        SourceColor,

        /// <summary>
        /// Each color component is multiplied by the inverse source color: (1 - Rs, 1 - Gs, 1 - Bs, 1 - As).
        /// </summary>
        InverseSourceColor,

        /// <summary>
        /// Each color component is multiplied by the alpha of the source color: (As, As, As, As).
        /// </summary>
        SourceAlpha,

        /// <summary>
        /// Each color component is multiplied by the inverse alpha of the source color: (1 - As, 1 - As, 1 - As, 1 - As).
        /// </summary>
        InverseSourceAlpha,

        /// <summary>
        /// Each color component is multiplied by the destination color: (Rd, Gd, Bd, Ad).
        /// </summary>
        DestinationColor,

        /// <summary>
        /// Each color component is multiplied by the inverse destination color: (1 - Rd,1 - Gd,1 - Bd,1 - Ad).
        /// </summary>
        InverseDestinationColor,

        /// <summary>
        /// Each color component is multiplied by the alpha of the destination color: (Ad, Ad, Ad, Ad).
        /// </summary>
        DestinationAlpha,

        /// <summary>
        /// Each color component is multiplied by the inverse alpha of the destination color: (1 - Ad,1 - Ad,1 - Ad,1 - Ad).
        /// </summary>
        InverseDestinationAlpha,

        /// <summary>
        /// Each color component is multiplied by a constant blend factor.
        /// </summary>
        BlendFactor,

        /// <summary>
        /// Each color component is muliplied by the inverse of a constant blend factor.
        /// </summary>
        InverseBlendFactor,

        /// <summary>
        /// Each color component is multiplied by either the alpha of the source color
        /// or the inverse of the alpha of the source color, whichever is greater: (f, f, f, 1) where
        /// f = min(A, 1 - Ad)
        /// </summary>
        SourceAlphaSaturation
    }

    /// <summary>
    /// Determines how data is used when a render target is activated.
    /// </summary>
    public enum RenderTargetUsage {
        /// <summary>
        /// Always clear the contents of the target.
        /// </summary>
        DiscardContents,

        /// <summary>
        /// Always keep the contents of the target
        /// </summary>
        PreserveContents,

        /// <summary>
        /// Use the platform default, which is either discard or preserve.
        /// </summary>
        PlatformDefault
    }

    /// <summary>
    /// Describes if presenting should enable or disable VSync.
    /// </summary>
    public enum PresentInterval {
        /// <summary>
        /// Present to the screen without waiting for vertical retrace.
        /// </summary>
        Immediate,

        /// <summary>
        /// Wait for one vertical retrace period.
        /// </summary>
        One,

        /// <summary>
        /// Wait for two vertical retrace periods.
        /// </summary>
        Two
    }

    /// <summary>
    /// Defines the display orientation.
    /// </summary>
    [Flags]
    public enum DisplayOrientation {
        /// <summary>
        /// Default orientation.
        /// </summary>
        Default = 0,
        /// <summary>
        /// Display is rotated CCW 90 degrees into a landscape orientation (width > height).
        /// </summary>
        LandscapeLeft = 1,
        /// <summary>
        /// Display is rotated CW 90 degrees into a landscape orientation (width > height).
        /// </summary>
        LandscapeRight = 2,
        /// <summary>
        /// Display is oriented where height is greater than width.
        /// </summary>
        Portrait = 4
    }

    /// <summary>
    /// Defines the type of an effect parameter.
    /// </summary>
    public enum EffectParameterType {
        /// <summary>
        /// Parameter is a void pointer.
        /// </summary>
        Void,
        /// <summary>
        /// Parameter is a boolean.
        /// </summary>
        Bool,
        /// <summary>
        /// Parameter is a 32-bit integer.
        /// </summary>
        Int32,
        /// <summary>
        /// Parameter is a 32-bit floating point.
        /// </summary>
        Single,
        /// <summary>
        /// Parameter is a string.
        /// </summary>
        String,
        /// <summary>
        /// Parameter is a texture.
        /// </summary>
        Texture,
        /// <summary>
        /// Parameter is a 1D texture.
        /// </summary>
        Texture1D,
        /// <summary>
        /// Parameter is a 2D texture.
        /// </summary>
        Texture2D,
        /// <summary>
        /// Parameter is a 3D texture.
        /// </summary>
        Texture3D,
        /// <summary>
        /// Parameter is a cube texture.
        /// </summary>
        TextureCube,
        /// <summary>
        /// Parameter is unknown.
        /// </summary>
        Unknown
    }

    /// <summary>
    /// Defines the class of an effect parameter.
    /// </summary>
    public enum EffectParameterClass {
        /// <summary>
        /// Parameter is a scalar value.
        /// </summary>
        Scalar,
        /// <summary>
        /// Parameter is a vector value.
        /// </summary>
        Vector,
        /// <summary>
        /// Parameter is a matrix value.
        /// </summary>
        Matrix,
        /// <summary>
        /// Parameter is either a texture, string, or other resource type.
        /// </summary>
        Object,
        /// <summary>
        /// Parameter is a struct.
        /// </summary>
        Struct
    }

    /// <summary>
    /// Defines how primitives should be filled.
    /// </summary>
    public enum FillMode {
        /// <summary>
        /// The entire primitive should be drawn and filled.
        /// </summary>
        Solid,
        /// <summary>
        /// Only the edges of primitives should be drawn.
        /// </summary>
        WireFrame
    }

    /// <summary>
    /// Defines the how vertices are wound. This defines the criteria
    /// to define what are the back and front of a primitive.
    /// </summary>
    public enum VertexWinding {
        /// <summary>
        /// CounterClockwise vertices are defined as Front facing. 
        /// </summary>
        CounterClockwise,
        /// <summary>
        /// Clockwise vertices are defined as Front facing. 
        /// </summary>
        Clockwise
    }

    /// <summary>
    /// Defines how a primitive should be culled.
    /// </summary>
    public enum CullMode {
        /// <summary>
        /// No primitive is culled.
        /// </summary>
        None = 1,
        /// <summary>
        /// Front facing primitives are culled.
        /// </summary>
        Front = 2,
        /// <summary>
        /// Back facing primitives are culled.
        /// </summary>
        Back = 3
    }

    /// <summary>
    /// Options to clear rendertargets and the back buffer.
    /// </summary>
    [Flags]
    public enum ClearOptions {
        /// <summary>
        /// Clear depth buffer.
        /// </summary>
        Depth = 1,
        /// <summary>
        /// Clear stencil buffer.
        /// </summary>
        Stencil = 2,
        /// <summary>
        /// Clear the render target/color buffer.
        /// </summary>
        Target = 4
    }
    /// <summary>
    /// Format for a vertex element in the vertex buffer.
    /// </summary>
    public enum VertexFormat {
        /// <summary>
        /// A float.
        /// </summary>
        Single,
        /// <summary>
        /// A 4 component vector packed into an unsigned 32 bit integer (8 bits per component),
        /// that will be expanded to (R,G,B,A) on the graphics card. Component values limited
        /// to 0-255 (byte) and 0-1 (float) range.
        /// </summary>
        Color,
        /// <summary>
        /// A 2-float vector.
        /// </summary>
        Vector2,
        /// <summary>
        /// A 3-float vector.
        /// </summary>
        Vector3,
        /// <summary>
        /// A 4-float vector.
        /// </summary>
        Vector4
    }

    /// <summary>
    /// Enumeration for vertex element usage, these correspond
    /// directly to the semantics of vertex-shader inputs. There is a certain
    /// level of disconnect of these semantics and actual store, since texture coordinates can
    /// be used for custom store and fog/point expansion must be done by the user.
    /// </summary>
    public enum VertexSemantic {
        /// <summary>
        /// Vertex position info in object space.
        /// </summary>
        Position = 0,
        /// <summary>
        /// Vertex normal store.
        /// </summary>
        Normal = 1,
        /// <summary>
        /// Vertex color store.
        /// </summary>
        Color = 2,
        /// <summary>
        /// Vertex texture coordinate. Often used for user-defined store also.
        /// </summary>
        TextureCoordinate = 3,
        /// <summary>
        /// Vertex binormal store.
        /// </summary>
        Binormal = 4,
        /// <summary>
        /// Vertex tangent store.
        /// </summary>
        Tangent = 5,
        /// <summary>
        /// Blending indices store for skinning.
        /// </summary>
        BlendIndices = 6,
        /// <summary>
        /// Blending weights for skinning.
        /// </summary>
        BlendWeight = 7,
        /// <summary>
        /// Vertex store contains depth information.
        /// </summary>
        Depth = 8,
        /// <summary>
        /// Vertex store contains fog information.
        /// </summary>
        Fog = 9,
        /// <summary>
        /// Vertex store contains size of point->quad expansion.
        /// </summary>
        PointSize = 10
    }

    /// <summary>
    /// Format for the index buffer.
    /// </summary>
    public enum IndexFormat {
        /// <summary>
        /// Short store type.
        /// </summary>
        SixteenBits,
        /// <summary>
        /// Int store type.
        /// </summary>
        ThirtyTwoBits
    }

    /// <summary>
    /// Options for writing data to a hardware resource.
    /// </summary>
    public enum DataWriteOptions {
        /// <summary>
        /// Default writing mode. Buffer may be overwritten using this.
        /// </summary>
        None = 0,
        /// <summary>
        /// This writing mode will discard all contents of the buffer. Only applicable for Dynamic 
        /// buffers.
        /// </summary>
        Discard = 1,
        /// <summary>
        /// This writing mode will not overwrite existing contents of the buffer. Only applicable
        /// for dynamic buffers.
        /// </summary>
        NoOverwrite = 2
    }

    /// <summary>
    /// Resource usage enumeration.
    /// </summary>
    public enum ResourceUsage {
        /// <summary>
        /// Resource is GPU-accessible only
        /// </summary>
        Static = 0,
        /// <summary>
        /// Resource is write-accessible by CPU. This is used
        /// in conjunction with DataWriteOptions.Discard and DataWriteOptions.NoOverwrite usually.
        /// </summary>
        Dynamic = 1
    }

    /// <summary>
    /// Addressing mode for textures.
    /// </summary>
    public enum TextureAddressMode {
        /// <summary>
        /// Tile the texture at every integer junction. E.g. For u values
        /// between 0 and 2, the texture is repeated twice. No mirroring is performed.
        /// </summary>
        Wrap,
        /// <summary>
        /// Texture coordinates are clamped to the range [0.0, 1.0]
        /// </summary>
        Clamp,
        /// <summary>
        /// Similar to wrap except the texture is flipped at every integer junction. E.g. for
        /// u values between 0 and 1, the texture is addressed normally but between 1 and 2,
        /// it is flipped and so on.
        /// </summary>
        Mirror
    }

    /// <summary>
    /// Enumeration for texture dimensions.
    /// </summary>
    public enum TextureDimensions {
        /// <summary>
        /// Texture1D
        /// </summary>
        One,
        /// <summary>
        /// Texture2D
        /// </summary>
        Two,
        /// <summary>
        /// Texture3D
        /// </summary>
        Three,
        /// <summary>
        /// TextureCube
        /// </summary>
        Cube
    }

    /// <summary>
    /// Enumeration for valid filtering schemes involving shrinking (minify), expanding (magnify),
    /// or filtering between mipmap levels.
    /// </summary>
    public enum TextureFilter {
        /// <summary>
        /// Use point filtering.
        /// </summary>
        Point,
        /// <summary>
        /// Use point filtering for min/mag and linear filtering for mip.
        /// </summary>
        PointMipLinear,
        /// <summary>
        /// Use linear filtering.
        /// </summary>
        Linear,
        /// <summary>
        /// Use linear filtering for min/mag and point filtering for mip.
        /// </summary>
        LinearMipPoint,
        /// <summary>
        /// Use linear filtering for min and mip, but point for mag.
        /// </summary>
        MinLinearMagPointMipLinear,
        /// <summary>
        /// Use linear filtering for min, and point filtering for both mag and mip.
        /// </summary>
        MinLinearMagPointMipPoint,
        /// <summary>
        /// Use point filtering for min, and linear filtering for both mag and mip.
        /// </summary>
        MinPointMagLinearMipLinear,
        /// <summary>
        /// Use point filtering for min and mip, but point for mip.
        /// </summary>
        MinPointMagLinearMipPoint,
        /// <summary>
        /// Use anisotropic filtering.
        /// </summary>
        Anisotropic
    }

    /// <summary>
    /// Enumeration of the faces of a CubeMap.
    /// </summary>
    public enum CubeMapFace {
        /// <summary>
        /// Face on the +X axis
        /// </summary>
        PositiveX = 0,
        /// <summary>
        /// Face on the -X axis
        /// </summary>
        NegativeX = 1,
        /// <summary>
        /// Face on the +Y axis
        /// </summary>
        PositiveY = 2,
        /// <summary>
        /// Face on the -Y axis
        /// </summary>
        NegativeY = 3,
        /// <summary>
        /// Face on the +Z axis
        /// </summary>
        PositiveZ = 4,
        /// <summary>
        /// Face on the -Z axis
        /// </summary>
        NegativeZ = 5
    }

    /// <summary>
    /// Defines a surface's encoding format.
    /// </summary>
    public enum SurfaceFormat {
        /// <summary>
        /// Unsigned 32-Bit ARGB pixel format with alpha, 8 bits per channel.
        /// </summary>
        Color,
        /// <summary>
        /// Unsigned 16-bit BGR pixel format with 5 bits for blue, 6 bits for green, and 5 bits for red.
        /// </summary>
        BGR565,
        /// <summary>
        /// Unsigned 16-bit BGRA pixel format with 5 bits for r,g,b channels and 1 bit for alpha.
        /// </summary>
        BGRA5551,
        /// <summary>
        /// DXT1 compression texture format. Surface dimensions must be in multiples of 4.
        /// </summary>
        DXT1,
        /// <summary>
        /// DXT3 compression texture format. Surface dimensions must be in multiples of 4.
        /// </summary>
        DXT3,
        /// <summary>
        /// DXT5 compression texture format. Surface dimensions must be in multiples of 4.
        /// </summary>
        DXT5,
        /// <summary>
        /// Unsigned 32-bit RGBA pixel format with 10 bits for r,g,b, channels and 2 bits for alpha.
        /// </summary>
        RGBA1010102,
        /// <summary>
        /// Unsigned 32-bit RG pixel format using 16 bits for red and green.
        /// </summary>
        RG32,
        /// <summary>
        /// Unsigned 64-bit RGBA pixel format using 16 bit for r,g,b,a channels.
        /// </summary>
        RGBA64,
        /// <summary>
        /// Unsigned 8-bit alpha.
        /// </summary>
        Alpha8,
        /// <summary>
        /// IEEE 32-bit float format using 32 bits for the red channel.
        /// </summary>
        Single,
        /// <summary>
        /// IEEE 64-bit float format using 32 bits for red and green.
        /// </summary>
        Vector2,
        /// <summary>
        /// IEEE 96-bit float format using 32 bits for red, green, blue.
        /// </summary>
        Vector3,
        /// <summary>
        /// IEEE 128-bit float format using 32 bits for r,g,b,a channels.
        /// </summary>
        Vector4,
    }

    /// <summary>
    /// Defines the format of a RenderTarget's depth buffer.
    /// </summary>
    public enum DepthFormat {
        /// <summary>
        /// No depth buffer to be created.
        /// </summary>
        None,
        /// <summary>
        /// A depth buffer that holds 16-bit depth data.
        /// </summary>
        Depth16,
        /// <summary>
        /// A depth buffer that holds 24-bit depth data.
        /// </summary>
        Depth24,
        /// <summary>
        /// A depth buffer that holds 32-bit depth data.
        /// </summary>
        Depth32,
        /// <summary>
        /// A depth buffer that holds 32-bit data, where 24 bits are for depth and 8 are for stencil.
        /// </summary>
        Depth24Stencil8
    }

    /// <summary>
    /// Defines the topology of the mesh store.
    /// </summary>
    public enum PrimitiveType {
        /// <summary>
        /// Vertex store is defined as a list of triangles, where every three new vertices make up a triangle.
        /// </summary>
        TriangleList,
        /// <summary>
        /// Vertex store is defined as a list of triangles where every two new vertices, and a vertex from the 
        /// previous triangle make up a triangle.
        /// </summary>
        TriangleStrip,
        /// <summary>
        /// Vertex store is defined as a list of lines where every two new vertices make up a line.
        /// </summary>
        LineList,
        /// <summary>
        /// Vertex store is defined as a list of lines where every one new vertex and a vertex from the previous line
        /// make up a new line.
        /// </summary>
        LineStrip

    }
}
